{template 'header'}
<link rel="stylesheet" href="{$siteRoot}addons/{$modular_name}/template/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="{$siteRoot}addons/{$modular_name}/template/kindeditor/plugins/code/prettify.css" />
<script charset="utf-8" src="{$siteRoot}addons/{$modular_name}/template/kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="{$siteRoot}addons/{$modular_name}/template/kindeditor/lang/zh-CN.js"></script>
<script charset="utf-8" src="{$siteRoot}addons/{$modular_name}/template/kindeditor/plugins/code/prettify.js"></script>
<ul class="nav nav-tabs">
    <li class=""><a href="{php echo $this->createWeburl('graphic');}">图文管理</a></li>
    <li class="active"><a href="{php echo $this->createWeburl('graphic', array('op' => 'addShow'));}">添加图文</a></li>
</ul>
<form action="" method="post" class="form-horizontal" id="myform" role="form" enctype="multipart/form-data">
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">标题:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="title" placeholder="标题" value="{$graphic['title']}" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">简约描述:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="subtitle" placeholder="简约描述" value="{$graphic['subtitle']}" type="text">
        </div>
    </div>


    <div class="form-group" id="ling-1">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">封面图:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            {php echo tpl_form_field_image('cover_image',  $graphic['cover_image'],  tomedia($graphic['cover_image']));}
            <small style="color: red">图片大小建议为 : 345 * 170</small>
        </div>
    </div>

    <div class="form-group" id="money">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">作者:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="author" placeholder="作者" value="{$graphic['author']}" type="text">
        </div>
    </div>

    <div class="form-group" >
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">作者头像:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            {php echo tpl_form_field_image('author_image',  $graphic['author_image'],  tomedia($graphic['author_image']));}
            <small style="color: red">图片大小建议为 : 150 * 150</small>
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">浏览量:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="browse" placeholder="浏览量" value="{$graphic['browse']}" type="text">
        </div>
    </div>
    <div class="form-group" id="compiler" >
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">具体内容:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12" style="padding-top:8px;">
            <textarea name="content" style="width:1000px;height:400px;visibility:hidden;">{$graphic['content']}</textarea>
        </div>
        <script>
            KindEditor.ready(function(K) {
                htmlEditor = K.create(
                    'textarea[name="content"]',
                    {
                        uploadJson : "{php echo $this->createWebUrl('editorUpload');}",
                        fileManagerJson : '{$siteRoot}addons/{$modular_name}/template/kindeditor/php/file_manager_json.php',
                        height : 300,
                        width : '90%',
                        resizeType : 0,//1
                        allowPreviewEmoticons : true,
                        allowImageUpload : true,
                        urlType:'domain',
                        formatUploadUrl:false
                    });
            });
        </script>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">是否显示</label>
        <div class="col-sm-9 col-xs-12">
            <label class="radio-inline">
                <input type="radio" name="state" value="1" {if $graphic['state'] ==1 || $graphic['state'] == ''} checked {/if} /> 显示
            </label>
            <label class="radio-inline">
                <input type="radio" name="state" value="2" {if $graphic['state'] ==2} checked {/if}/>隐藏
            </label>
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label">顺序:</label>
        <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
            <input class="form-control" name="sort" placeholder="顺序" value="{$graphic['sort']}" type="text">
        </div>
    </div>

    <div class="form-group">
    <label class="col-xs-12 col-sm-3 col-md-1 control-label">发布时间:</label>
    <div class="col-sm-7 col-lg-8 col-md-8 col-xs-12">
       {php echo  _tpl_form_field_date('created', $graphic['created'],  false)}
    </div>
    </div>
    <div class="form-group">
        <label class="col-xs-12 col-sm-3 col-md-1 control-label"></label>
        <div class="" >
            <input type="hidden" name="op" value="{php echo $id ? 'edit' : 'add'}">
            <input type="hidden" name="id" value="{$id}">
            <input type="submit" name="submit" id="submit" value="{php echo $id ? '修改' : '新增'}" class="btn btn-primary">
        </div>
    </div>
</form>
{template 'footer'}


<script>
    $(function () {
        $("input[name='exchange_type']").click(function () {
            if ( $(this).val() == 1) {
                $('#exchange_type_money').show();
                $('#money').hide();
            }  else {
                $('#exchange_type_money').show();
                $('#money').show();
            }
        });


        $("input[name='is_free']").click(function () {
            if ( $(this).val() == 1) {
                $('#is_free_money').hide();
            }  else {
                $('#is_free_money').show();
            }
        });

        $("input[name='type']").click(function () {
            if ( $(this).val() == 1) {
                $('#bag_money').hide();
            }  else {
                $('#bag_money').show();
            }
        });

    })


</script>